<?php 
use_helper("Date");
use_helper("Number");
slot("shop_slot");?>
<div>
    <form method="post" action="<?php url_for("@confirm_shop_course?token={$token}&pprice_id={$Price->getId()}&course_slug={$Course->getSlug()}" ) ?>">
    <?php 
    	$Publication= $Price->getPublication();
    	$Course=$Publication->getCourse();
    ?>
    <div>
    	<h4><?php echo __("Información del Curso")?></h4>
    	<table class="show_info">
    		<tbody>
    			<tr>
    				<th><?php echo __("Código"); ?></th>
    				<td><?php echo $Course->getCode();?></td>
    			</tr>
    			<tr>
    				<th><?php echo __("Título"); ?></th>
    				<td><?php echo $Course->getName() ?></td>
    			</tr>
    			<tr>
    				<th><?php echo __("Fecha de inicio"); ?></th>
    				<td><?php echo format_date($Publication->getStartDate(),"D")?></td>
    			</tr>
    			<tr>
    				<th><?php echo __("Fecha de Finalización"); ?></th>
    				<td><?php 
    					$endDate=$Publication->getEndDate();
    					if($endDate){
    					echo format_date($Publication->getEndDate(),"D");
    					}else{
    						echo __("Indefinido");
    					}
    					?></td>
    			</tr>
    		</tbody>
    	</table>
    </div>
    <div>
    	<h4><?php echo __("Información de Usuario")?></h4>
    	<table class="show_info">
    		<tbody>
	    		<tr>
	    			<th>
	    				<?php echo __("Nombre y Apeillido")?>
	    			</th>
	    			<td><?php echo $sf_user->getGuardUser()->getFirstName(). " " .$sf_user->getGuardUser()->getLastName() ?></td>
	    		</tr>
	    		<tr>
	    			<th>
	    				<?php echo __("email")?>
	    			</th>
	    			<td>
	    				<?php echo $sf_user->getGuardUser()->getEmailAddress() ?>
	    			</td>
	    		</tr>
    		</tbody>
    	</table>
    </div>
    <div>
    <h4><?php echo __("Información de Pago")?></h4>
    <table class="tbl-short show_info" style="width: auto; margin: 0;" >
    		<thead>
    			<tr>
    				<th><?php echo __("Fechas De Pago")?></th>
    				<th><?php echo __("Monto")?></th>
    			</tr>
    		</thead>
			<tbody>
				<?php 
                $totalAmount=0;
                foreach( $Price->getCustomizations() as $PriceCustom){
                  $totalAmount+=$PriceCustom->getAmount();
					?>
					<tr>
						<td>
							<?php echo format_date($PriceCustom->getExpiresAt(),"D")?>
						</td>
						<td><?php echo format_currency($PriceCustom->getAmount()); ?></td>
					</tr>
					<?php 
				}?>
			</tbody>
            <tfoot>
              <tr>
                <td><?php echo __("Total")?></td>
                <td class="bold"><?php echo format_currency($totalAmount) ?></td>
              </tr>
            </tfoot>
    	</table>
    </div>
        <table>
            <?php echo $form ?>
        </table>
        <input type="hidden" name="sf_method" value="put" />
        <input type="submit" value="Confirmar mi compra" />
        <?php echo button_to("volver", "@shop_course?token={$token}&publication_id={$Price->getPublication()->getId()}&course_slug={$Course->getSlug()}") ?>
    </form>
    
    
</div>

<?php  end_slot(); ?>
<?php include_partial("shopLayout", array("selected"=>$selected))?>
